#include <stdio.h>

int main() {
    int start_year = 1000;
    int end_year = 2016;
    
    for (int year = start_year; year <= end_year; year++) {
        if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) {
            printf("%d ", year);
        }
    }
    
    return 0;
}
